package com.autumn.cloud.demo.provider.services.dubbo;

import com.autumn.cloud.demo.dubbo.api.bo.OrderInfoBO;
import com.autumn.cloud.demo.dubbo.api.services.OrderApiService;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * <p>
 * </p>
 *
 * @description TODO
 * @author: 老码农
 * @create: 2020-12-16 15:15
 **/
public abstract class AbstractOrderApiService implements OrderApiService {

    @Override
    public List<OrderInfoBO> orders() {
        List<OrderInfoBO> items = new ArrayList<>();
        Random random = new Random();
        for (int i = 1; i <= 10; i++) {
            OrderInfoBO orderInfo = new OrderInfoBO();
            int id = random.nextInt(100000);
            orderInfo.setOrderId((long) (i + id));
            orderInfo.setOrderTitle("订单" + i);
            orderInfo.setOrderMoney(new BigDecimal(random.nextInt(320000)));
            orderInfo.setOrderTime(LocalDateTime.now());
            items.add(orderInfo);
        }
        return items;
    }
}
